<template>
  <div class="main">
    <div class='container'>
        <div class="container-left">
            <div class="container-top">
                <div class="top">
                    <div>
                        <div class="title">
                            内容详情
                        </div>
                    </div>
                    <div class="oper">
                        <el-button type="primary" class="close" icon="iconfont icon-guanbi" @click="back">关闭</el-button>
                    </div>
                </div>
            </div>
            <div class="content">
                <p class="contentTitle">{{detailData.title}}</p>
                <div class="contentText" v-html="detailData.content"></div>
                <el-button type="button" icon="iconfont icon-xiangmushenbao" class="green" @click="onShenBao(detailData.project_id)" v-if="type==='2'">项目申报</el-button>
            </div>
        </div>
    </div>
  </div>
</template>
<script>
import { NoticeDeatils, UserInfo } from '@/api/login'
export default {
  name: 'ListDetails',
  data () {
    return {
        detailData: '',
        noticeid: '',
        projectid: '',
        type: '',
        token: ''
    }
  },
  methods: {
    onShenBao(projectid){
        this.$router.push({
            path: '/shenbaozhongxin',
            query: {
                project_id: projectid
            }
        })
    },
    // 获取用户信息
    queryUserInfo(){
        UserInfo({
            token: this.token
        }).then((result)=>{  
            const {data} = result;
            this.type = data.user_type;
        })
    },
    // 获取详情信息
    queryNoticeDeatils(){
        NoticeDeatils({
            token: this.token,
            notice_id: this.noticeid
        }).then((result) => {
            const {data} = result;
            this.detailData = data;
        })
    },
    backgroundShow(){
        this.$emit('backgroundShow',this.Showbg)
    },
    back(){
      this.$router.go(-1)
    }
  },
  created(){
    this.backgroundShow()
  },
  mounted(){
    const token = sessionStorage.getItem('token');
    const noticeid = this.$route.query.notice_id;
    this.token = token;
    this.noticeid = noticeid;
    this.queryUserInfo();
    this.queryNoticeDeatils();
  }
}
</script>
<style lang='scss' scoped>
.main{
    font-family: 'Avenir', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding: 0;
    color: #242748;
    margin: 0 auto;
    position: relative;
    font-size: 18px;
    margin: 0 50px 20px 30px;
    text-align: left;
    font-family: "PingFang";
    .container{
        height: 100%;
        &>div{
            width: 100%;
            background-color: #fff;
            border-radius: 5px;
        }
        .content{
            position: relative;
            padding: 40px;
            height: 880px;
            overflow-y: auto;
            font-size: 18px;
            .contentTitle{
                font-size: 22px;
                color: #242748;
                text-align: center;
                line-height: 32px;
                font-weight: 700;
                margin-bottom: 50px;
            }
            /deep/.contentText{
                line-height: 50px;
                img{
                    display: table-cell;
                    width: 40%;
                    margin: 0 auto;
                }
                span{
                    font-size: 20px!important;
                    font-family: "PingFang"!important;
                }
            }
        }
    .container-top{
        padding: 33px 45px 25px;
        border-bottom: solid 1px #e7e9eb;
        .top{
            display: flex;
            justify-content: space-between;
            margin-bottom: 30px;
            &>div:first-child{
                display: flex;
                align-items: center;
                .title{
                    font-size: 26px;
                    font-family: "黑体";
                    color: #5673ff;
                    margin-right: 60px;
                }
            }
            .column{
                display: flex;
                font-size: 16px;
                .item{
                    display: flex;
                    align-items: center;
                    padding-right: 20px;
                    img{
                        width: 15px;
                        height: 15px;
                        margin-right: 12px;
                    }
                }
                /deep/.el-badge__content.is-fixed.is-dot{
                    left: 2px;
                    top: 2px;
                }
            }
            .oper{
                .shrink{
                    background-color: #69a1ff;
                    border: solid 1px #4d8df7;
                    box-shadow: 0px 4px 15.52px 0.48px rgba(73, 100, 245, 0.39);
                }
                /deep/.icon-zhankai{
                    font-size: 18px;
                }
            }
        }
        .article{
            display: flex;
            align-items: center;
            p{
                display: flex;
                align-items: center;
                width: 30%;
                margin-right: 75px;
                color: #a1a4b5;
            }
            span{
                display: inline-block;
                width: 75%;
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
            }
        }
    }
    .close{
        width: 100px;
        height: 35px;
        line-height: 35px;
        padding: 0;
        border: solid 1px #e7e9eb;
        background-color: rgb(255, 255, 255);
        box-shadow: 0px 4px 15.52px 0.48px rgba(73, 100, 245, 0.14);
        color: #242748;
        /deep/i{
            margin-right: 8px;
            vertical-align: bottom;
        }
    }
    .green{
        display: block;
        margin: 0 auto 50px;
        background-color: #03c5a9;
        padding: 0.1375rem 0.25rem;
        border: none;
        font-family: "PingFang";
        font-weight: 700;
        color: #fff;
        /deep/i{
            margin-right: 5px;
        }
    }
    }
}
</style>
